#include "sys.h"
/* bit num chosen for this example */
#define WP_PAGES_BIT_1                  (8U)
#define WP_PAGES_BIT_2                  (9U)
#define WP_PAGES_BIT_3                  (10U)
#define WP_ALL_PAGES_BITMAP             (0xFFFFU)

/* construct the bitmap which pages need to be configured the write protection */
#define WRITE_PROTECT_PAGES(bit_num)    (BIT(bit_num))

/* every bit in OB_WP indicates 4 pages if they are in write protection */
#define PAGE_NUM_PER_WP_BIT             (4U)

/* address and data for fmc operation */
#define ERASE_PAGE                      (WP_PAGES_BIT_3 * PAGE_NUM_PER_WP_BIT)
#define ERASE_PAGE_START_ADDR           (0x08000000U + 0x400U * ERASE_PAGE)

#define PROGRAM_ADDRESS                 ERASE_PAGE_START_ADDR
#define PROGRAM_DATA                    (0x12345678U)
void fmc_erase_and_program(uint8_t size);
uint16_t fmc_ReadWord(uint32_t faddr);
void fmc_ReadContinusWord(uint32_t ReadAddr,uint16_t *pBuffer,uint16_t NumToRead);